//
//  CommonPopViewController.m
//  FactorySale
//
//  Created by Huazhi_xi on 2020/10/10.
//  Copyright © 2020 主事丫环. All rights reserved.
//

#import "CommonPopViewController.h"
#import "UIViewController+pop.h"

@interface CommonPopViewController ()
@property (weak, nonatomic) IBOutlet UIView *tipsView;
@property (weak, nonatomic) IBOutlet UILabel *titleLbl;
@property (weak, nonatomic) IBOutlet UILabel *messageLbl;
@property (weak, nonatomic) IBOutlet UIButton *cancleBtn;
@property (weak, nonatomic) IBOutlet UIButton *confirmBtn;

@end

@implementation CommonPopViewController

- (instancetype)init {
    if (self = [super initWithNibName:nil bundle:nil]) {
        self.modalPresentationStyle = UIModalPresentationCustom;
        self.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    _tipsTitle ? (self.titleLbl.text = _tipsTitle) : nil;
    _message ? (self.messageLbl.text = _message) : nil;
    _cancleBtnTitle ? ([self.cancleBtn setTitle:_cancleBtnTitle forState:UIControlStateNormal]) : nil;
    _confirmBtnTitle ? ([self.confirmBtn setTitle:_confirmBtnTitle forState:UIControlStateNormal]) : nil;

}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self animationAlert:self.tipsView];
}
// 取消
- (IBAction)cancelButtonClick:(UIButton *)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}
// 确定
- (IBAction)confirmButtonClick:(UIButton *)sender {
    self.confirmBtnClick ? self.confirmBtnClick() : nil;
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
